//
//  BlockImages.m
//  CoreGraphicsTest
//
//  Created by aewatson on 11/23/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "BlockImages.h"

@class SpriteModel;

@implementation BlockImages

@synthesize redAnim;
@synthesize blueAnim;
@synthesize greenAnim;
@synthesize yellowAnim;
@synthesize bulletImages;

- (id) initWithRedAnim:(NSMutableArray*) newRedAnim blueAnim:(NSMutableArray*) newBlueAnim greenAnim:(NSMutableArray*) newGreenAnim yellowAnim:(NSMutableArray*) newYellowAnim andBullets:(NSMutableArray*) newBullets {
    
    self = [super init];
    
    [self setRedAnim: [[[NSMutableArray alloc] initWithArray:newRedAnim] retain]];
    [self setBlueAnim: [[[NSMutableArray alloc] initWithArray:newBlueAnim] retain]];
    [self setGreenAnim: [[[NSMutableArray alloc] initWithArray:newGreenAnim] retain]];
    [self setYellowAnim: [[[NSMutableArray alloc] initWithArray:newYellowAnim] retain]];
    [self setBulletImages:[[[NSMutableArray alloc] initWithArray:newBullets] retain]];
    return self;
}

- (UIImage*) getBlockImageForColor:(COLOR) blockColor andState:(int) blockState{
    UIImage *image;
    switch (blockColor) {
        case RED:
            image = [redAnim objectAtIndex:blockState];
            break;
        case BLUE:
            image = [blueAnim objectAtIndex:blockState];
            break;
        case YELLOW:
            image = [yellowAnim objectAtIndex:blockState];
            break;
        case GREEN:
            image = [greenAnim objectAtIndex:blockState];
            break;
        default:
            break;
    }
    return image;
}

- (UIImage*) getBulletImageForColor:(COLOR) bulletColor {
    UIImage *image;
    switch(bulletColor) {
        case YELLOW:
            image = [bulletImages objectAtIndex:0];
            break;
        case RED:
            image = [bulletImages objectAtIndex:1];
            break;
        case BLUE:
            image = [bulletImages objectAtIndex:2];
            break;
        case GREEN:
            image = [bulletImages objectAtIndex:3];
            break;
        default:
            break;
    }
    return image;
}

@end
